package custom;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.qianfeng.lingshijia.R;

import utils.DownloadUtils;

/**
 * Created by Mr.xingkong on 2016/1/11.
 */
public class Commodity_totalList extends LinearLayout
{
    private Context context;
    ImageView commodityPicture;
    TextView commodityName,commodityPrice,commodityMessage;
    public ImageView shoppingCart_iv_total;
    public Commodity_totalList(Context context)
    {
        super(context);
        this.context = context;
        initView();
    }

    public Commodity_totalList(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        this.context = context;
        initView();
    }

    private void initView()
    {
        LayoutInflater.from(context).inflate(R.layout.commodity_layout_totallist,this);
        commodityPicture = (ImageView) findViewById(R.id.commodity_pic);
        commodityName = (TextView) findViewById(R.id.commodity_name);

        commodityPrice = (TextView) findViewById(R.id.commodity_price);
        commodityMessage = (TextView) findViewById(R.id.commodity_message);

         shoppingCart_iv_total = (ImageView) findViewById(R.id.shoppingCart_iv_total);
    }

    /**
     * 设置数据
     * @param picUrl
     * @param name
     * @param price
     * @param message
     */
    public void setData(String picUrl,String name ,String price)
    {
        DownloadUtils.LoadPicture(picUrl,commodityPicture);
        commodityName.setText(name);
        commodityPrice.setText(price);
    }

    public TextView getMessage()
    {
        return commodityMessage;
    }
}
